
public class Icicle extends Entity implements Freezable, Collidable
{
	public Speed speed; 
	public boolean released = false;
	boolean hasCollided = false;
	long lastUpdate;
	int originX;
	int originY;
	public Icicle(Game game, int x, int y, SpriteImage sprite) 
	{
		super(game, x, y, sprite);
		speed = new Speed(x, y);
		originX = x;
		originY = y;
	}
	
	@Override
	public void update(long gameTime) 
	{
//		speed.gravity();
	//	System.out.println("Speed");
		adjacentTiles = findAdjacentTiles();
		adjacentTiles.add(game.player);
		for (Entity tile: adjacentTiles)
		{
			if(collidesBottom(tile))
			{
				if (tile instanceof Collidable)
				{
					released = false;
					speed.setvY(0);
					y = tile.y - sprite.height;
					game.tileMap.remove(new BlockLocation(originX, originY));
					game.tileMap.put(new BlockLocation(x,y), this);
					hasCollided = true;
				}
				if (tile instanceof Player)
				{
					if (!hasCollided)
					{
						((Player) tile).health -= 30;
						hasCollided = true;
					}
				}
			}
		}
		
		if (released)
		{
			y =  y + (int)((gameTime - lastUpdate) / 10 * speed.getvY());
		}
		speed.gravity();
		lastUpdate = gameTime;
		super.update(gameTime);
	}
	
	@Override
	public void melt() 
	{
		released = true;
	}
	@Override
	public void freeze() {
		// TODO Auto-generated method stub
		
	}

}
